package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.BusContent;
import com.example.service.BusContentService;
import com.example.mapper.BusContentMapper;
import org.springframework.stereotype.Service;

/**
* @author CETC
* @description 针对表【bus_content】的数据库操作Service实现
* @createDate 2025-10-21 11:42:52
*/
@Service
public class BusContentServiceImpl extends ServiceImpl<BusContentMapper, BusContent>
    implements BusContentService{

    @Override
    public boolean disableBusContentListByContentId(String contentId) {
        LambdaUpdateWrapper<BusContent> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(BusContent::getContentId, contentId);
        updateWrapper.set(BusContent::getIsEnable, false);
        return this.update(updateWrapper);
    }

    @Override
    public boolean deleteBusContentListByContentIdThan20(String contentId) {
        return false;
    }

    @Override
    public BusContent getContent(String contentId) {
        LambdaUpdateWrapper<BusContent> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        lambdaUpdateWrapper.eq(BusContent::getContentId, contentId);
        lambdaUpdateWrapper.eq(BusContent::getIsEnable, true);
        return this.getOne(lambdaUpdateWrapper);
    }
}




